import http from '@/utils/http.js'

/**
 * getCategory
 * @returns
 */
export function getCategory() {
    return http.get(`/category/get`);
}



/**
 * 通过条件获取商品信息
 * @param {string} params goodsName
 * @param {string} params categoryId
 * @returns
 */
export function getGoodsAPI(params) {
    return http.post(`/goods/basic`,params);
}

/**
 * 获取商品详情
 * @param {object} params IdRequest
 * @param {number} params.id
 * @returns
 */
export function getGoodsDetailsAPI(params) {
    return http.post(`/goods/detail`, params);
}

/**
 * 商品删除
 * @param {string} id
 * @returns
 */
export function deleteGoodsAPI(id) {
    return http.delete(`/goods/${id}`);
}

/**
 * 商品上下架
 * @param {object} params GoodsRequest
 * @param {number} params.spuId
 * @param {string} params.spuStatus
 */
export function changeStatusAPI(params) {
    return http.post(`/goods/changeStatus`, params);
}

/**
 * sku商品库存修改
 * @param {object} params GoodsSkuRequest
 * @param {number} params.skuId
 * @param {number} params.stock
 * @returns
 */
export function changeStockAPI(params) {
    return http.post(`/goods/changeStock`, params);
}

/**
 * 商品添加
 * @param {object} params GoodsAddRequest
 * @param {number} params.id
 * @param {string} params.name
 * @param {number} params.spuPrice
 * @param {number} params.categoryId
 * @param {number} params.categoryParentId
 * @param {number} params.brandId
 * @param {string} params.des
 * @param {string} params.spuStatus
 * @param {string} params.mainImage
 * @param {string} params.video
 * @param {string} params.spuDiscount
 * @param {array} params.spuImageAddRequest
 * @param {array} params.spuAttrValueAddRequest
 * @param {array} params.goodsSkuAddRequest
 * @returns
 */
export function addGoodsAPI(params) {
    return http.post(`/goods/add`, params);
}